package com.hexb.arithmetic.astart
{
	/**
	 * @author hexb
	 * */
	public class APoint
	{
		//坐标
		public var x:int ;
		public var y:int ;
		
		//上一个点
		private var _parentPoint:APoint = null ;
		
		//仅对于父节点的G，H值
		private var _gValue:int = 0 ;
		private var _hValue:int = 0 ;
		
		//总G值
		private var _gValueTotal:int = 0 ;
		
		public function APoint(x:int,y:int)
		{
			this.x = x ;
			this.y = y ;
		}
		
		//对于起点的A到当前点的G值

		public function get gValueTotal():int{
			return _gValueTotal ;
		}
		
		//设置父节点
		public function set parentPoint(value:APoint):void
		{
			_parentPoint = value;
			_gValue = AStartUtils.countGvalue(_parentPoint,this);
			_gValueTotal = _parentPoint.gValueTotal + _gValue ;
		}
		
		public function get fValue():int{
			return this.gValueTotal + this.hValue ;
		}
		/*------------------------------------------------------------------------*/
		/*-----------------------getter and setter--------------------------------*/
		/*------------------------------------------------------------------------*/
		
		public function get parentPoint():APoint
		{
			return _parentPoint;
		}
		
		public function get hValue():int
		{
			return _hValue;
		}

		public function set hValue(value:int):void
		{
			_hValue = value;
		}

		public function get gValue():int
		{
			return _gValue;
		}

		public function set gValue(value:int):void
		{
			_gValue = value;
		}
		
		public function toString():String{
			return "[ " + x + ":" + y +" ]"
		}

	}
}